package com.xunfei.noteapp.room

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.xunfei.noteapp.data.Note

@Dao
interface NoteDao {

    @Query("SELECT * FROM note ORDER BY timestamp DESC")
    suspend fun getAllNotes():MutableList<Note>

    @Insert
    suspend fun addNote(note:Note): Long

    @Delete
    suspend fun delNote(note:Note)

    @Query("DELETE FROM note where id=:id")
    suspend fun delNoteById(id:Long)
}